<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<%@page import="javax.jdo.PersistenceManager"%>
<%@page import="kr.icg.icgmshtest1.PMF"%>
<%@page import="kr.icg.icgmshtest1.Wish"%>
<%@page import="java.util.List"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@page import="kr.icg.icgmshtest1.BaramSelection"%><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<title>네게바라</title>
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript"> google.load("jquery", "1.4.2"); </script>
<script src="jqtouch/jqtouch.min.js" type="application/x-javascript" charset="utf-8"></script>
<style type="text/css" media="screen">@import "./jqtouch/jqtouch.min.css";</style>
<style type="text/css" media="screen">@import "./themes/apple/theme.min.css";</style>
<script type="text/javascript" src="IncludeFiles/Init.js"></script>
<style type="text/css" media="screen">@import "./IncludeFiles/Init.css";</style>
</head>
<body>

<div id="home" class="current">
	<div class="toolbar">
		<h1>네게바라</h1>
        <a class="button slideup" id="infoButton" href="#about">About</a>
	</div>
	<ul class="rounded">
		<li class="forward"><a href="#registerWish">내게바라 등록하기</a></li>
	</ul>
	<form action="AjaxServices/searchresult.jsp" method="post">
	<ul class="rounded edit">
		<li class="forward"><a href="#" class="submit">내게바라 검색하기</a></li>
		<li>
			<input type="text" name="toNameLast" value="" maxlength="20" 
				placeholder="성" 
				style="height: 36px;" />
			<input type="text" name="toNameFirst" value="" maxlength="20"  
				placeholder="이름" 
				style="height: 36px;" />
		</li>
	</ul>
	</form>
	<h2>네게바라 리스트 (최근 10건)</h2>
<%
PersistenceManager pm = PMF.get().getPersistenceManager();
String query = "select from " + Wish.class.getName() + " order by date desc limit 10";
List<Wish> wishes = (List<Wish>) pm.newQuery(query).execute();
if (wishes.isEmpty()) {
%>
	<ul class="rounded">
		<li>내게바라 리스트가 등록되지 않았습니다.</li>
	</ul>
<%
} else {
	for (Wish w : wishes) {
%>
	<ul class="rounded">
		<li class="arrow">
			<a href="AjaxServices/searchresult.jsp?
				toNameFirst=<%= w.getToNameFirst() %>&toNameLast=<%= w.getToNameLast() %>">
				<small><%= new SimpleDateFormat("MM.dd").format(w.getDate()) %></small>
				<em>to.</em> <%= w.getToNameLast() %> <%= w.getToNameFirst() %>
			</a>
		</li>
		<li><%= BaramSelection.getBaramContent(w.getContentNumber()) %></li>
	</ul>
<%
	}
}
%>
<%@ include file="IncludeFiles/Info.jsp" %>
</div>

<form id="registerWish" action="AjaxServices/registeredwish.jsp" method="POST"> 
    <div class="toolbar"> 
        <h1>네게바라</h1> 
        <a href="#home" class="back">home</a>
        <a class="button slideup" id="infoButton" href="#about">About</a> 
    </div> 
    <ul class="rounded">
    	<li>
    		<em>1. 좋아하는 사람의 이름을 입력하고</em><br />
    		<em>2. 그에게 하고픈 말을 선택한 후</em><br />
    		<em>3. '바람등록' 버튼을 누르세요.</em><br />
    	</li>
    </ul>
	<h2>To.</h2>
	<ul class="individual">
		<li><input type="text" name="toNameLast" placeholder="성" /></li>
		<li><input type="text" name="toNameFirst" placeholder="이름" /></li>
	</ul>
	<h2>널 좋아하지만 아직 용기가 없어</h2>
	<ul class="edit rounded">
		<li>
			<select id="contentNumberID" name="contentNumber">
					<option value="0" selected>너도 날 좋아한다면..</option>
				<optgroup label="행동 바라기">
					<option value="1">수업시간 내 옆에 앉아줘.</option>
					<option value="2">함께 걸을 때 슬쩍 팔짱 껴 줘.</option>
					<option value="3">내 머릴 쓰다듬어 줘.</option>
					<option value="4">잠이 안올 때 내게 전화해 줘.</option>
					<option value="5">손을 잡고 끌어줘.</option>
				</optgroup>
				<optgroup label="듣고 싶은 말">
					<option value="6">예쁘다고 말해줘</option>
					<option value="7">여행가자고 말해줘</option>
					<option value="8">어린시절 이야기를 들려줘</option>
				</optgroup>
				<optgroup label="비밀약속">
					<option value="9">일주일 후 오늘 만난 장소, 같은 시각에 다시 만나자</option>
					<option value="10">발 맞춰 걸어줘</option>
				</optgroup>
			</select>
		</li>
	</ul>
	<a style="margin:0 10px; color:rgba(0,0,0,.9)" href="#" class="submit whiteButton">네게바라 등록</a><br />
<%@ include file="IncludeFiles/Info.jsp" %>
</form>

<div id="about" class="selectable" style="text-align: center;">
	<br /><br />
	<p><img src="https://www.google.com/a/cpanel/icg.kr/images/logo.gif?service=lso" /></p>
	<br /><br /> 
	<p><strong>네게바라</strong><br />Version 1.0 beta<br /> 
	    <a href="http://www.icg.kr">Initiative Counsulting Group</a></p> 
	<p><em>Create powerful mobile apps with<br /> just HTML, CSS, and jQuery.</em></p> 
	<p> 
	    <a href="http://twitter.com/jqtouch" target="_blank">@jQTouch on Twitter</a> 
	</p> 
	<p><br /><br /><a href="#" class="grayButton goback">Close</a></p> 
</div>

</body>
</html>